// $codepro.audit.disable numericLiterals
/*
 * Copyright (c) 2011 Team A CS2340. All rights reserved.
 */

package edu.gatech.teama.doctorsoffice.model;

import java.util.Hashtable;

/**
 * @author Bruce Zhang
 * @version 1.0
 */
public class TreatmentsTable { // $codepro.audit.disable com.instantiations.assist.eclipse.analysis.audit.rule.effectivejava.alwaysOverridetoString.alwaysOverrideToString
	
	/**
	 * hash table of treamments
	 */
	private static Hashtable<String,Double> treatments;
	
	/**
	 * initialize treatsments and add treatments name as string
	 * price as double
	 */
	static
	{
		treatments = new Hashtable<String,Double>();
		/*
		 * 
		 *	Vaccines: Flu $25.00, Tetanus $30.00, MMR $15.00, Hepatitis A $50.00,
		 *	Steroid $56.00
		 *	Labs: Urinalysis (BUN) $50.00, Urinalysis (Drug Test) $25.00, CBC
		 *	$75.00, Cholesterol $40.00, HIV $100.00, Glucose $75.00, Adrenal
		 *	$65.00, EKG $100.00, MRI $1000.00
		 *	Treatments: Office Visit Base $50.00, Phone Consult $35.00, Annual
		 *	Physical $75.00
         *
		 * */
		treatments.put("Flu", 25.00);
		treatments.put("Tetanus", 30.00); // $codepro.audit.disable numericLiterals
		treatments.put("MMR", 15.00); // $codepro.audit.disable numericLiterals
		treatments.put("Hepatitis A", 50.00); // $codepro.audit.disable numericLiterals
		treatments.put("Steroid", 56.00); // $codepro.audit.disable numericLiterals
		treatments.put("Urinalysis (BUN)", 50.00); // $codepro.audit.disable numericLiterals
		treatments.put("Urinalysis (Drug Test)", 25.00); // $codepro.audit.disable numericLiterals
		treatments.put("CBC", 75.00); // $codepro.audit.disable numericLiterals
		treatments.put("Cholesterol", 40.00); // $codepro.audit.disable numericLiterals
		treatments.put("HIV", 100.00); // $codepro.audit.disable numericLiterals
		treatments.put("Glucose", 75.00); // $codepro.audit.disable numericLiterals
		treatments.put("Adrenal", 65.00); // $codepro.audit.disable numericLiterals
		treatments.put("EKG", 100.00); // $codepro.audit.disable numericLiterals
		treatments.put("MRI", 1000.00); // $codepro.audit.disable numericLiterals
		treatments.put("Office Visit Base", 50.00); // $codepro.audit.disable numericLiterals
		treatments.put("Phone Consult", 35.00); // $codepro.audit.disable numericLiterals
		treatments.put("Annual Physical", 75.00); // $codepro.audit.disable numericLiterals
	}
	
	/**
	 * @param treat the treatment that is done
	 * @return the price of the treatment
	 */
	public static double getPrice(String treat){
		System.out.println("treat " + treat);
		return treatments.get(treat);
	}
	
	/**
	 * @param treat the treatment as a string
	 * @return if this string is existed
	 */
	public static boolean isTreatment(String treat){
		if(treat == null){
			throw new NullPointerException();
		}
		else{
			return treatments.containsKey(treat);
		}	
	}
	
	/**
	 * get matching treatment name
	 * @param treatment
	 * @return s/null
	 */
	public static String getMatchingTreatmentName(String treatment) {
		for (String s : treatments.keySet()) {
			if (treatment.toLowerCase().contains(s.toLowerCase())){
				return s;
			}
		}
		
		return null;
	}
}
